﻿namespace HealthAR
{
    using Common;
    using HuaweiARUnitySDK;
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class HealthARContorller : MonoBehaviour
    {
        [Tooltip("health prefabs")]
        public GameObject healthPrefabs;

        private List<ARFace> m_newFaces = new List<ARFace>();

        void Update()
        {
            _DrawFace();
        }

        private void _DrawFace()
        {
            m_newFaces.Clear();
            ARFrame.GetTrackables<ARFace>(m_newFaces, ARTrackableQueryFilter.NEW);
            for (int i = 0; i < m_newFaces.Count; i++)
            {
                GameObject faceObject = Instantiate(healthPrefabs, Vector3.zero, Quaternion.identity, transform);
                faceObject.GetComponent<HealthVisualizer>().Initialize(m_newFaces[i]);
            }
        }
    }


}
